import { T_srv, Tsrv, ifs, ts, tvs, vue } from '@/services';
import { I_cmd, T_cmd } from './command';
import { N_SlotBodySet } from './type';

const treeConfig = () => {
  return {
    name: '',
    comment: '',
    isCreated: false,
    status: '',
    dbType: 'mysql',
    tableStyle: {
      showHeader: true,
      showFooter: false,
      showToolbar: true,
      border: true,
      mode: 'nav'
    },
    tableColumns: [],
    uniqueIndexes: [],
    indexes: [],
    rules: [],
    toolbar: {
      default: true,
      expandAll: true,
      contractAll: true,
      mutiSelect: true,
      addon: []
    },
    tableDataSetting: {
      editable: true
    },
    tableDataSource: {
      main: {
        name: 'tank_equip_config',
        fields: [
          {
            field: 'equip_name',
            keyField: true,
            childField: false,
            isShow: true,
            filter: ''
          },
          {
            field: 'p_id',
            keyField: false,
            childField: true,
            isShow: false,
            filter: ''
          }
        ],
        id: '608917658029322240'
      }
    },
    messageConfig: {
      custDefListener: {
        coordination: 'E6FDB069C97C1D5D'
      },
      emitActions: {
        search: [
          {
            toID: 'F89E6892A3359B85',
            msg: {
              type: 'search',
              content: {
                ikey: 'id',
                ukey: 'p_id',
                val: ''
              }
            },
            sourceToID: 'tank_equip_config'
          }
        ],
        refresh: []
      },
      eventGroup: {
        '': {
          custDefListener: {
            coordination: 'E6FDB069C97C1D5D'
          },
          children: [
            {
              tank_equip_config: {
                custDefListener: {
                  coordination: '37A316BED8AC1320'
                },
                children: []
              }
            }
          ]
        }
      }
    }
  };
};

const rowData = (): N_SlotBodySet.rowData[] => [
  {
    classification: 3,
    equip_name: '排污控制',
    f_comment: '',
    'm2o|_da_ecbox_id|_da_ecbox_det|f_code': 'my987',
    'm2o|attribute_id|_da_ecbox_det|f_code': 'my1083',
    'm2o|p_id|tank_equip_config|equip_name': '化学除油1槽',
    'slc|classification|614648110232965120': 'air_agitation'
  },
  {
    classification: 2,
    equip_name: '喷淋控制',
    f_comment: '',
    'm2o|_da_ecbox_id|_da_ecbox_det|f_code': 'my987',
    'm2o|attribute_id|_da_ecbox_det|f_code': 'my1083',
    'm2o|p_id|tank_equip_config|equip_name': '化学除油1槽',
    'slc|classification|614648110232965120': 'air_agitation'
  },
  {
    classification: 1,
    equip_name: '空气搅拌',
    f_comment: '空气搅拌阀重复导入',
    'm2o|_da_ecbox_id|_da_ecbox_det|f_code': 'my987',
    'm2o|attribute_id|_da_ecbox_det|f_code': 'my1083',
    'm2o|p_id|tank_equip_config|equip_name': '化学除油1槽',
    'slc|classification|614648110232965120': 'air_agitation'
  },
  {
    classification: 3,
    equip_name: '排污控制',
    f_comment: '',
    'm2o|_da_ecbox_id|_da_ecbox_det|f_code': 'my987',
    'm2o|attribute_id|_da_ecbox_det|f_code': 'my1083',
    'm2o|p_id|tank_equip_config|equip_name': '碱腐蚀2槽',
    'slc|classification|614648110232965120': 'air_agitation'
  },
  {
    classification: 2,
    equip_name: '喷淋控制',
    f_comment: '',
    'm2o|_da_ecbox_id|_da_ecbox_det|f_code': 'my987',
    'm2o|attribute_id|_da_ecbox_det|f_code': 'my1083',
    'm2o|p_id|tank_equip_config|equip_name': '碱腐蚀2槽',
    'slc|classification|614648110232965120': 'air_agitation'
  },
  {
    classification: 1,
    equip_name: '空气搅拌',
    f_comment: '空气搅拌阀重复导入',
    'm2o|_da_ecbox_id|_da_ecbox_det|f_code': 'my987',
    'm2o|attribute_id|_da_ecbox_det|f_code': 'my1083',
    'm2o|p_id|tank_equip_config|equip_name': '碱腐蚀2槽',
    'slc|classification|614648110232965120': 'air_agitation'
  }
];

const configData = (): N_SlotBodySet.configData[] => {
  return [
    {
      equipName: '空气搅拌',
      classification: 1,
      isAuto: {
        code: 'my987',
        value: 'true'
      },
      isRunning: {
        code: 'my1083',
        value: true
      },
      pId: '化学除油1槽'
    },
    {
      equipName: '喷淋控制',
      classification: 2,
      isAuto: {
        code: 'my987',
        value: 'true'
      },
      isRunning: {
        code: 'my1083',
        value: true
      },
      pId: '化学除油1槽'
    },
    {
      equipName: '排污控制',
      classification: 3,
      isAuto: {
        code: 'my987',
        value: 'true'
      },
      isRunning: {
        code: 'my1083',
        value: true
      },
      pId: '化学除油1槽'
    },
    {
      equipName: '空气搅拌',
      classification: 1,
      isAuto: {
        code: 'my987',
        value: 'true'
      },
      isRunning: {
        code: 'my1083',
        value: true
      },
      pId: '碱腐蚀2槽'
    },
    {
      equipName: '喷淋控制',
      classification: 2,
      isAuto: {
        code: 'my987',
        value: 'true'
      },
      isRunning: {
        code: 'my1083',
        value: true
      },
      pId: '碱腐蚀2槽'
    },
    {
      equipName: '排污控制',
      classification: 3,
      isAuto: {
        code: 'my987',
        value: 'true'
      },
      isRunning: {
        code: 'my1083',
        value: true
      },
      pId: '碱腐蚀2槽'
    }
  ];
};

// my787 0 手动 my788 0关闭

const nonTankConfigData = (): N_SlotBodySet.NonTankDeviceControl => {
  return {
    doorCover: {
      allowIndividualControl: {
        code: 'my780',
        value: false
      },
      allOpen: {
        code: 'my493',
        value: false
      },
      allClose: {
        code: 'my494',
        value: false
      }
    },
    pumps: {
      oilWaterSeparator: {
        code: 'my848',
        value: false
      },
      chemicalDeoilingMixer: {
        code: 'my849',
        value: false
      },
      chromeAdditiveMixer: {
        code: 'my850',
        value: false
      }
    },
    slotEdgeTransmission: {
      isAuto: {
        code: 'my787',
        value: 'false'
      },
      isRunning: {
        code: 'my788',
        value: false
      }
    },
    carStop: {
      stopStation: {
        code: 'mycSlotBodySet059',
        value: 0,
        conversionRate: 0.1
      },
      stopTime: {
        code: 'mycSlotBodySet060',
        value: 0,
        conversionRate: 0.1
      }
    },
    dryingTank26: {
      windCutDelay: {
        code: 'mycSlotBodySet001',
        conversionRate: 0.1,
        value: 0
      },
      rightLimit: {
        code: 'my782',
        value: false
      },
      leftLimit: {
        code: 'my781',
        value: false
      },
      solenoidValve: {
        code: 'my793',
        value: false
      },
      start: {
        code: 'my783',
        value: false
      },
      stop: {
        code: 'my784',
        value: false
      },
      status: {
        manualMode: {
          code: 'my785',
          value: false
        },
        ready: {
          code: 'my786',
          value: false
        }
      }
    }
  };
};

export {
  I_cmd,
  N_SlotBodySet,
  T_cmd,
  T_srv,
  Tsrv,
  configData,
  ifs,
  nonTankConfigData,
  rowData,
  treeConfig,
  ts,
  tvs,
  vue
};
